import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue' //首页
import About from '../views/About.vue' //test
import Apply from '../views/apply/index.vue'
import ApplyFirst from '../views/apply/first.vue' //申请类型
import Ly1 from '../views/apply/ly1.vue' //领用选择分类
import GoodsList from '../views/common/GoodsList.vue' //领用选择分类
import Cart from '../views/common/Cart.vue' //领用选择型号列表
import Lydinfoun from '../views/apply/Lydinfoun.vue' //领用单据列表
import LyFinish from '../views/apply/finish.vue' //领用单据列表
import Search from '../views/common/Search.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta: {
      title: '主页',
      icon: 'home',
    },
  },
  {
    path: '/About',
    name: 'About',
    component: About,
    meta: {
      title: 'guayu',
      
    },
  },
  {
    path: '/GoodsList',
    name: 'GoodsList',
    component: GoodsList,
    meta: {
      title: '选择设备型号',
    },
  },
  {
    path: '/Cart',
    name: 'Cart',
    component: Cart,
    meta: {
      title: '已选型号',
      rightText: '批量',
    },
  },
  {
    path: '/Search',
    name: 'Search',
    component: Search,
    meta: {
      title: '搜索',
    },
  },
  {
    path: '/apply',
    name: 'Apply',
    component: Apply,
    meta: {
      title: '',
    },
    children: [
      {
        path: '',
        redirect: { name: 'first' },
      },
      {
        path: 'first',
        name: 'first',
        component: ApplyFirst,
        meta: {
          title: '选择申请类型',
        },
      },
      {
        path: 'Ly1',
        name: 'Ly1',
        component: Ly1,
        meta: {
          title: '选择分类',
        },
      },
      {
        path: 'Lydinfoun',
        name: 'Lydinfoun',
        component: Lydinfoun,
        meta: {
          title: '填写领用单据信息',
          rightText: '提交',
        },
      },
      {
        path: 'LyFinish',
        name: 'LyFinish',
        component: LyFinish,
        meta: {
          title: '',
        },
      },
    ],
  },

  // {
  // 	path: "/UserInfo",
  // 	name: "UserInfo",
  // 	component: UserInfo,
  // 	meta: {
  // 		title: "我"
  // 	}
  // },
  // {
  // 	path: "/Login",
  // 	name: "Login",
  // 	component: Login,
  // 	meta: {
  // 		title: "登录"
  // 	}
  // },
  // {
  // 	path: "/Card",
  // 	name: "Card",
  // 	component: Card,
  // 	children: [{
  // 		path: "Personal",
  // 		name: "Personal",
  // 		component: BindCard,
  // 		meta: {
  // 			title: "绑定个人卡"
  // 		}
  // 	},
  // 	{
  // 		path: "Business",
  // 		name: "Business",
  // 		component: BindCard,
  // 		meta: {
  // 			title: "绑定单位卡"
  // 		}
  // 	},
  // 	{
  // 		path: "BindCardSuccess",
  // 		name: "BindCardSuccess",
  // 		component: BindCardSuccess,
  // 		meta: {
  // 			title: "绑定个人卡",
  // 			icon: 'home'
  // 		}
  // 	},
  // 	{
  // 		path: "CardDetail",
  // 		name: "CardDetail",
  // 		component: CardDetail,
  // 		meta: {
  // 			title: "卡片详情"
  // 		}
  // 	},
  // 	{
  // 		path: "CardManager",
  // 		name: "CardManager",
  // 		component: CardManager,
  // 		meta: {
  // 			title: "卡片管理"
  // 		}
  // 	},
]

const router = new VueRouter({
  routes,
})

// router.beforeEach((to, from, next) => {
// 	let isAuthenticated = localStorage.getItem('ticketId')
// 	if (to.name !== 'Login' && !isAuthenticated) {
// 		localStorage.clear();

// 		next({
// 			name: 'Login'
// 		})
// 	} else {
// 		next()
// 	}

// })

export default router
